<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>svg</title>
		<script type="text/javascript" src="d3.v4.min.js"></script>
		<style type="text/css">
			body {
				font-family: Arial;
			}
		</style>
	</head>
	<body>
		<div id="svgcontainer">

		</div>
		<p></p>
		<p></p>
	</body>
	<script type="text/javascript">
		var height = 300;
		var width = 300;
		var svg = d3.select("#svgcontainer")
			.append("svg")
			.attr("width", width)
			.attr("height", height)
			
		//在svg中添加line元素
		svg.append("line")
			.attr("x1",100)
			.attr("y1",100)
			.attr("x2",200)
			.attr("y2",200)
			.style("stroke","red")
			.style("stroke-width",4)
	</script>
</html>
